var t = getApp();

Page({
    data: {
        active: 0,
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        wx.setNavigationBarTitle({
            title: "售后审核"
        }), this.init(), this.getData();
    },
    init: function() {
        this.setData({
            listData: [],
            isLoadMore: !0,
            page: 1,
            total_page: 0
        });
    },
    tapchange: function(t) {
        this.setData({
            active: t.detail.index
        }), this.init(), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : console.log("没有更多了");
    },
    onShareAppMessage: function() {},
    refundExamine: function(a) {
        var e, o = this, i = a.currentTarget.dataset.key, n = a.currentTarget.dataset.item;
        if (1 == i) e = 1; else if (2 == i) e = 2; else if (3 == i) return void wx.navigateTo({
            url: "/packageD/member/myOrder/Aftersales/Aftersales?refund_id=" + n.refund_id + "&debt=4"
        });
        var s = t.getNetAddresss("plugin.debt-shop.frontend.debtor.refundExamine");
        t._postNetWork({
            url: s,
            data: {
                status: e,
                id: n.id
            },
            success: function(t) {
                var a = t.data;
                1 == a.result ? (wx.showToast({
                    title: a.msg,
                    duration: 1e3,
                    icon: "none"
                }), o.init(), o.getData()) : wx.showToast({
                    icon: "none",
                    title: a.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getData: function() {
        var a, e = this, o = t.getNetAddresss("plugin.debt-shop.frontend.debtor.refundList");
        a = 0 == this.data.active ? 0 : [ "1", "-1", "-2" ], t._postNetWork({
            url: o,
            data: {
                status: a
            },
            success: function(t) {
                var a = t.data;
                1 == a.result ? (e.data.isLoadMore = !0, e.data.total_page = a.data.last_page, e.data.total_page || (e.data.total_page = 0), 
                e.setData({
                    listData: a.data.data
                })) : wx.showToast({
                    icon: "none",
                    title: a.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMoreData: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            var e;
            this.data.page = this.data.page + 1, e = 0 == this.data.active ? [ "0", "-1", "-2" ] : 1;
            var o = t.getNetAddresss("plugin.debt-shop.frontend.debtor.refundList");
            t._getNetWork({
                url: o,
                data: {
                    page: this.data.page,
                    json: e
                },
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? (a.data.isLoadMore = !0, a.setData({
                        listData: e.data.data
                    })) : (a.data.page = a.data.page - 1, a.isLoadMore = !1, wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1500
                    }));
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    }
});